package com.taotao.complier.calcu.ast;

import com.taotao.complier.calcu.visit.Visitor;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class ExprNode implements AstNode {

    //expr -> term  expr2

    private TermNode term;
    private Expr2Node expr2;


    @Override
    public void accept(Visitor visitor) {
        // 左右根 后续遍历
        if (null != term) {
            term.accept(visitor);
        }

        if (null != expr2) {
            expr2.accept(visitor);
        }

        visitor.visitExpr(this);
    }
}
